//show and hide
function showAndHide(hideId,showId){
	document.getElementById(hideId).style.display="none";
	document.getElementById(showId).style.display="block";

}

//set class on selected header
function selectedHeader(setClassId){
	jQuery('li.jewelHead').removeClass('selectedHeader');
	jQuery("#"+setClassId).addClass('selectedHeader');
}

//confirmation function
function confirmation(){
	var isConfirm=confirm("Are You Sure to delete?");
	return isConfirm;
}

/*Display Success Message*/
function msgDisplay(msg){
	if(msg!=null && msg!=""){
		alert(msg);
	}
}

function digitsOnly(obj){
	obj.value=obj.value.replace(/[^\d]/g,'');
}

$(function(){	
	$( ".datepicker" ).datepicker({
		dateFormat: "yy-mm-dd",
		numberOfMonths: 1,
		showButtonPanel: true
	});
});

var myArray = [];

jQuery(document).ready(function() {
	var otable=jQuery('#excelInfo').dataTable( {
		"bPaginate"      : true,
        "sPaginationType": "full_numbers",// PaginationType:1.full_numbers 2. two_buttons
        "aLengthMenu": [
                        [10, 20, 50, 100, -1],
                        [10, 20, 50, 100, "All"]
                    ], 
        "aoColumns": [
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px","bSortable": false},
			
		],
 	/* "aaSorting": [[ 0, "desc" ]] , */
		/* sDom and oTableTools attribute --save data into csv,excel , pdf etc format */

		/* "sDom": 'T<"clear">lfrtip',

		"oTableTools": {
            "sSwfPath": "/jewel/scripts/swf/copy_csv_xls_pdf.swf",
            "aButtons": [
            	{
                	"sExtends": "collection",
                    "sButtonText": "Download <span class='caret' />",
                    "aButtons": [
                    	
                        "pdf",
                        {
                        	"sExtends":"xls",
                        	"sFileName": "*.xls"

                        }
                        
                    ]
            	},
            ]
        }
*/
	 });
	
	/*$('#excelInfo tbody').on( 'click', 'tr', function () {
		$(this).toggleClass('selected');
	} );
	*/   
	//var jsonData="[";
	var getdate="";
	
	/*$('#excelInfo tbody').on('click', 'tr', function (event) {        
		var aData = otable.fnGetData(this); // get datarow
		if ($(this).hasClass('selected')) {
			if (null != aData){  // null if we clicked on title row
				getdate=aData[7];
				
				
				
jsonData=jsonData+"{slipNo:"+aData[1]+",truckNo:"+aData[2]+",vmsInDate:"+aData[6]+",vmsTareWeight:"+aData[8]+",vmsOutDate:"+aData[11]+
			"vmsGrossWeight:"+aData[13]+",vmsNetWeight:"+aData[14]+",vsInDate:"+aData[26]+",vsGrossWeight"+aData[27]+
			",vsOutDate:"+aData[31]+",vsTareWeight:"+aData[33]+",vsNetWeight:"+aData[34]+",dumpLocation:"+aData[35]+"},";
				
				if(myArray.length!=0){
					var check=true;
					for(var i=0;i<myArray.length;i++) {
						alert('check'+myArray[i]+"=="+aData[2]);
						if (myArray[i]==aData[2]){
							alert('yes');
							check=false;
							break;
						}
					}
					if(check){
						alert('check=='+check);
						myArray.push(aData[2]);
					}
				}
				else{
					myArray.push(aData[2]);
				}
				alert('myArray=='+myArray);
			}
			
			//now aData[0] - 1st column(count_id), aData[1] -2nd, etc. 
		}
		else{
			alert("selected==");
			for(var i = myArray.length; i--;) {
				if(myArray[i] == aData[2]) {
					myArray.splice(i, 1);
				}
		  	}
		}
		var elem = document.getElementById("challan1Ids");
		elem.value=myArray;
		alert('myArray  myArray='+myArray);
		
	});
*/
	jQuery('#billedReport').dataTable( {
		"bPaginate"      : true,
        "sPaginationType": "full_numbers",// PaginationType:1.full_numbers 2. two_buttons
        "aLengthMenu": [
                        [10, 20, 50, 100, -1],
                        [10, 20, 50, 100, "All"]
                    ], 
        "aoColumns": [
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
			
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px"},
			{ "sWidth":"100px" },
			{ "sWidth":"100px"},
						
			{ "sWidth":"100px","bSortable": false},
			
		],
 	});

 }); 

function submitSelectedRows(){
	/*var date = getdate;
	var month=date.split('-');
	var challanDate=month[1];
	alert('challanDate=='+challanDate);
	
*/
		
	return true;
}

